﻿using System;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows;
using XAMLStylePad.ViewModels;
using FireFly;

namespace XAMLStylePad
{
    /// <summary>
    /// RelayCommand with typical for editing commands condition of execution.
    /// </summary>
    public class EditCommand<TViewModel> : RelayCommand<TViewModel> where TViewModel : IViewModel
    {
        public EditCommand(Action<CommandExecutionContext<TViewModel, IUIContext>> execute, string cmdKey)
            : base(execute, context => context != null && context.ViewModel != null && !context.ViewModel.IsReadOnly, cmdKey)
        {
        }
    }
}